﻿using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Shapes;
using System.Windows.Media;

namespace AgLux
{
    /// <summary>
    /// //
    /// </summary>

    public class Text : Component
    {
        protected TextBlock _text;
       
         

        /// <summary>
        /// //
        /// </summary>

        /// <param name="content">
        /// //
        /// </param>
        
        public Text(List<Inline> content, string backColor)
            : base()
        {
            _text = (TextBlock)_resource.FindName("text");
            _screen = (Canvas)_resource.FindName("screen");

            foreach (Inline part in content)
            {
                _text.Inlines.Add(part);
            }
            
            _text.Visibility = Visibility.Visible;


            if (backColor!="")
            {
                _screen.SetValue(Canvas.BackgroundProperty, backColor);
               
            }
            
        }


        protected override void SizeStandard(object sender, System.Windows.Input.MouseEventArgs args)
        {
  
        }
        /// <summary>
        /// //
        /// </summary>

        /// <param name="canvasWidth">
        /// //
        /// </param>

        public override void FitCanvas(double canvasWidth)
        {
           // Width = ScreenWidth =  1000;
            Width = ScreenWidth = canvasWidth;
            Height = ScreenHeight = _text.ActualHeight;
        }

        /// <summary>
        /// //
        /// </summary>

        /// <param name="value">
        /// //
        /// </param>

        protected override double ScreenWidth
        {
            set
            {
               _screen.Width = _text.Width = value;
               
            }
        }
        /// <summary>
        /// //
        /// </summary>

        /// <param name="value">
        /// //
        /// </param>

        protected override double ScreenHeight
        {
            set
            {
                _screen.Height = _text.Height = value;
            }
        }
    }
}
